package com.ad.pet.message.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.models.remote.message.Message;

import java.util.List;

/**
 * Created by SEELE on 2019/6/21.
 */

public class MesGridAdapter extends BaseQuickAdapter<Message,BaseViewHolder> {
    public MesGridAdapter( @Nullable List<Message> data) {
        super(R.layout.item_top_message, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Message item) {
        TextView tvTitle = helper.getView(R.id.tvTitle);
        TextView tvNumber = helper.getView(R.id.tv_msg_num);
        ImageView imageView = helper.getView(R.id.iv_icon);



        tvTitle.setText(item.getName());
        tvNumber.setText(String.valueOf(item.getNum()));
        if (item.getNum()==0){
            tvNumber.setVisibility(View.GONE);
        }else {
            tvNumber.setVisibility(View.VISIBLE);
        }
        GlideUtil.load(mContext, item.getImg(), imageView);

    }
}
